If you need to include an external C/C++ header file in a generated C++ file, do the following:
- Select the model element in the Project Explorer that translates into the generated C++ file where you want to include the file (for example, a class or capsule.)
- Right-click and choose "Show Code View" to make the code view visible.
- Click one of the tabs in the code view. Click "Header Preface" if you want to add the include to the header file, and click "Implementation Preface" if you want to include it to the implementation file.
- Type the #include in the code view. If you want more space you can click "Show Source in Editor" to open the code snippet in the code editor instead.
As always when editing C++ code using the code view or code editor, load the generated source (right-click in the editor and choose the command from the context menu or press Ctrl + Shift + L). By doing so, the generated C++ file gets loaded into the code view or code editor and all editing features of Eclipse CDT become available. If you edit without doing this step, some editing features are missing.